<template>
  <div class="container">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="远程命令" name="first">
        <el-form ref="dataForm" :model="conModel" label-width="90px" size="mini" class="search_content">
          <el-row :gutter="24">
            <el-col :span="4" class="common_input">
              <el-form-item label="关键词:">
                <el-input v-model="conModel.SearchKey" clearable placeholder="" @keyup.enter.native="getList('search')" />
              </el-form-item>
            </el-col>
            <el-col :span="4" class="common_input">
              <el-form-item label="IC卡卡号:">
                <el-input v-model="conModel.ICCardNo" clearable placeholder="请输入IC卡卡号" @keyup.enter.native="getList('search')" />
              </el-form-item>
            </el-col>
            <el-col :span="4" class="common_input">
              <el-form-item label="客户名称:">
                <el-input v-model="conModel.Name" clearable placeholder="请输入客户名称" @keyup.enter.native="getList('search')" />
              </el-form-item>
            </el-col>
            <el-col :span="1" class="common_query">
              <el-button size="mini" @click="getList('search')">
                <span>查询</span>
              </el-button>
            </el-col>
          </el-row>
          <p class="tips">1.勾选下方的表计列表，选择以下命令进行远程发送  2.一定要选择发送时间  3.点击执行按钮</p>
          <el-row :gutter="24" style="padding-top: 0 !important">
            <el-col :span="16">
              <el-form-item label="命令类型:">
                <el-radio v-model="order" label="ReadMeter">抄表</el-radio>
                <el-radio v-model="order" label="ValveOn">普通开阀</el-radio>
                <el-radio v-model="order" label="ForceValveOn">强制开阀</el-radio>
                <el-radio v-model="order" label="ValveOff">普通关阀</el-radio>
                <el-radio v-model="order" label="AuthValveOff">授权关阀</el-radio>
                <el-radio v-model="order" label="ReleaseValve">解除阀控</el-radio>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24" style="padding-top: 0 !important">
            <el-col :span="4" style="width: 100px">
              <el-form-item label="">
                <el-radio v-model="order" label="ChangePrice">远程调价</el-radio>
              </el-form-item>
            </el-col>
            <el-col :span="4" style="width: 300px">
              <el-form-item label="" class="common_input">
                <el-select v-model="PriceNo" clearable filterable placeholder="请选择价格方案" :disabled="status" @change="getList('search')">
                  <el-option
                    v-for="item in listPricePlan"
                    :key="item.PriceNo"
                    :label="item.p.PriceName"
                    :value="item.p.PriceNo"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="4" class="common_picker" style="width: 303px">
              <el-form-item label="发送时间:">
                <el-date-picker
                  v-model="conModel.PlanSendTime"
                  type="datetime"
                  format="yyyy-MM-dd HH:mm"
                  alue-format="yyyy-MM-dd HH:mm"
                  placeholder=""
                  size="mini"
                  class="search_common_picker"
                />
              </el-form-item>
            </el-col>
            <div class="common_query">
              <el-col :span="1" :offset="1">
                <el-button @click="remoteOrder"><span>执行</span></el-button>
              </el-col>
            </div>
          </el-row>
        </el-form>
      <div class="table_content">
          <el-table
            ref="multipleTable"
            v-loading="listLoading"
            :data="list"
            fit
            style="width: 100%;"
            :stripe="true"
            @select="mySelect"
            @select-all="mySelect"
          >
            <el-table-column
              type="selection"
            />
            <el-table-column align="center" label="区域名称">
              <template slot-scope="scope">
                {{ scope.row.EstateName }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="IC卡卡号">
              <template slot-scope="scope">
                {{ scope.row.CardNo }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="铭牌号">
              <template slot-scope="scope">
                {{ scope.row.BarCode }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="通信编号">
              <template slot-scope="scope">
                {{ scope.row.CommNo }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="客户名称">
              <template slot-scope="scope">
                {{ scope.row.CustomerName }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="计量点">
              <template slot-scope="scope">
                {{ scope.row.Address }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="开户状态">
              <template slot-scope="scope">
                {{ scope.row.MeterStateName }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="价格名称">
              <template slot-scope="scope">
                {{ scope.row.PriceName }}
              </template>
            </el-table-column>
          </el-table>
        </div>
        <pagination v-show="total>0" class="my_pagination" :total="total" :PageIndex.sync="Parameter.PageIndex" :PageSize.sync="Parameter.PageSize" @pagination="getList" />
      </el-tab-pane>
      <el-tab-pane label="命令查询" name="second">
        <el-form ref="dataForm" :model="conModelCtrl" label-width="72px" size="mini" class="search_content">
          <el-row :gutter="24">
            <el-col :span="4" class="common_input">
              <el-form-item label="通信编号:">
                <el-input v-model="conModelCtrl.TargetCommNoList" clearable placeholder="请输入通信编号" @keyup.enter.native="CtrlQuery('search')" />
              </el-form-item>
            </el-col>
            <el-col :span="4" class="common_input">
              <el-form-item label="处理程序:">
                <el-select v-model="conModelCtrl.ProcessorName" clearable>
                  <el-option key="-1" label="请选择" value=""></el-option>
                  <el-option key="1" label="物联网表" value="iotmeterv1"></el-option>
                  <el-option key="2" label="IC无线预付费表" value="icrfmeterv2"></el-option>
                  <el-option key="3" label="无线后付费表" value="wlmeterv2"></el-option>
                  <el-option key="4" label="LoRaWAN表" value="lorameterv1"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="4" class="common_input">
              <el-form-item label="设备类型:" prop="BranchAddr">
                <el-select v-model="conModelCtrl.TargetDevtype" clearable>
                  <el-option key="-1" label="请选择" value=""></el-option>
                  <el-option key="1" label="表计" value="1"></el-option>
                  <el-option key="2" label="RTU" value="2"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24" class="second_row_2">
            <el-col :span="4" class="common_input">
              <el-form-item label="生成时间:">
                <el-date-picker
                  v-model="conModelCtrl.CtrlTimeFrom"
                  type="datetime"
                  format="yyyy-MM-dd HH:mm"
                  alue-format="yyyy-MM-dd HH:mm"
                  placeholder="开始时间"
                  size="mini"
                  class="remote_search_picker"
                />
              </el-form-item>
            </el-col>
            <el-col :span="4" class="common_input">
              <el-form-item label="至:">
                <el-date-picker
                  v-model="conModelCtrl.CtrlTimeTo"
                  type="datetime"
                  format="yyyy-MM-dd HH:mm"
                  alue-format="yyyy-MM-dd HH:mm"
                  placeholder="结束时间"
                  size="mini"
                  class="remote_search_picker"
                />
              </el-form-item>
            </el-col>
            <el-col :span="4" class="common_input">
              <el-form-item label="任务状态:" prop="BranchAddr">
                <el-select v-model="conModelCtrl.CtrlStateList" clearable>
                  <el-option key="-1" label="请选择" value=""></el-option>
                  <el-option key="0" label="等待发送" value="0"></el-option>
                  <el-option key="1" label="已经发送和已缓存" value="1"></el-option>
                  <el-option key="2" label="已经应答" value="2"></el-option>
                  <el-option key="3" label="任务成功" value="3"></el-option>
                  <el-option key="4" label="任务失败" value="4"></el-option>
                  <el-option key="5" label="任务被取消" value="5"></el-option>
                  <el-option key="6" label="任务超时" value="6"></el-option>
                  <el-option key="7" label="发送数据失败" value="7"></el-option>
                  <el-option key="99" label="其他错误" value="99"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="1" class="common_query">
              <el-button size="mini" @click="CtrlQuery('search')">
                <span>查询</span>
              </el-button>
            </el-col>
          </el-row>
          <el-row :gutter="24" class="second_row_2">
            <el-col :span="1" class="common_query">
              <el-button size="mini" @click="CtrlRetry()">
                <span>重发命令</span>
              </el-button>
            </el-col>
            <el-col :span="1" :offset="1" class="common_query">
              <el-button size="mini" @click="CtrlCancel()">
                <span>取消命令</span>
              </el-button>
            </el-col>
          </el-row>
        </el-form>
        <div class="table_content">
          <el-table
            ref="multipleTable_2"
            v-loading="listLoading"
            :data="listCtrl"
            fit
            style="width: 100%;"
            :stripe="true"
            @select="mySelect_2"
            @select-all="mySelect_2"
            >
            <el-table-column
              type="selection"
            />
            <el-table-column align="center" label="流水">
              <template slot-scope="scope">
                {{ scope.row.CtrlId }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="铭牌号">
              <template slot-scope="scope">
                {{ scope.row.BarCode }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="客户名称">
              <template slot-scope="scope">
                {{ scope.row.CustomerName }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="计量点">
              <template slot-scope="scope">
                {{ scope.row.Address }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="处理程序">
              <template slot-scope="scope">
                {{ Processor(scope.row.ProcessorName) }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="任务类型">
              <template slot-scope="scope">
                <el-tooltip class="block_content_item" effect="light" :content="scope.row.CtrlTypeMsg" placement="bottom" popper-class="test_tooltip">
                  <span class="block_content">{{ scope.row.CtrlTypeMsg }}</span>
                </el-tooltip>
              </template>
            </el-table-column>
            <el-table-column align="center" label="通信编号">
              <template slot-scope="scope">
                {{ scope.row.TargetCommNo }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="设备类型">
              <template slot-scope="scope">
                {{ Devtype(scope.row.TargetDevtype) }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="生成时间">
              <template slot-scope="scope">
                {{ scope.row.CtrlTime | dateFormat }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="超时时间">
              <template slot-scope="scope">
                {{ scope.row.CtrlTimeout | dateFormat }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="任务状态">
              <template slot-scope="scope">
                {{ scope.row.CtrlStateMsg }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="反馈信息">
              <template slot-scope="scope">
                <el-tooltip class="block_content_item" effect="light" :content="scope.row.CtrlFeedbackMsg" placement="bottom" popper-class="test_tooltip">
                  <span class="block_content">{{ scope.row.CtrlFeedbackMsg }}</span>
                </el-tooltip>
              </template>
            </el-table-column>
            <el-table-column align="center" label="操作">
            <template slot-scope="{row}">
              <span class="common_operation" @click="detailsPopup(row)">详情</span>
            </template>
          </el-table-column>
          </el-table>
        </div>
        <pagination v-show="totalCtrl>0" class="my_pagination" :total="totalCtrl" :PageIndex.sync="ParameterCtrl.PageIndex" :PageSize.sync="ParameterCtrl.PageSize" @pagination="CtrlQuery" />
      </el-tab-pane>
    </el-tabs>
    <!-- 详情 -->
    <el-dialog title="远程命令详情" :visible.sync="dialogDetails" class="newel-dialog details_pupop common_details">
      <div class="el-dialog__body">
        <el-form ref="dataForm" :model="tempDetails" class="demo-ruleForm common_popup" label-width="160px">
          <div class="common_details_bg"></div>
          <el-row :gutter="24">
            <el-col :span="10" :offset="2">
              <div class="grid-content bg-purple">
                <el-form-item label="事物流水号:">
                  <span> {{ tempDetails.CtrlId }} </span>
                </el-form-item>
                <el-form-item label="处理程序标识:">
                  <span> {{ Processor(tempDetails.ProcessorName) }} </span>
                </el-form-item>
                <el-form-item label="通信编号:">
                  <span> {{ tempDetails.TargetCommNo }} </span>
                </el-form-item>
                <el-form-item label="自定义命令编号:">
                  <span> {{ tempDetails.CtrlDefineNo }} </span>
                </el-form-item>
                <el-form-item label="设备类型:">
                  <span> {{ Devtype(tempDetails.TargetDevtype) }} </span>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="9" :offset="1">
              <div class="grid-content bg-purple">
                <el-form-item label="任务类型:">
                  <span> {{ CtrlState(tempDetails.CtrlState) }} </span>
                </el-form-item>
                <el-form-item label="生成时间:">
                  <span> {{ date(tempDetails.CtrlTime)  }} </span>
                </el-form-item>
                <el-form-item label="超时时间:">
                  <span> {{ date(tempDetails.CtrlTimeout)  }} </span>
                </el-form-item>
                <el-form-item label="任务状态:">
                  <span> {{ tempDetails.CtrlStateMsg  }} </span>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="20" :offset="2">
              <div class="grid-content bg-purple">
                <el-form-item label="反馈信息:">
                  <el-tooltip class="block_content_item" effect="dark" :content="tempDetails.CtrlFeedbackMsg"  placement="bottom" popper-class="test_tooltip">
                    <span class="block_content">{{ tempDetails.CtrlFeedbackMsg }}</span>
                  </el-tooltip>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="20" :offset="2">
              <div class="grid-content bg-purple">
                <el-form-item label="任务数据:">
                  <el-tooltip class="block_content_item" effect="dark" :content="tempDetails.CtrlData"  placement="bottom" popper-class="test_tooltip">
                    <span class="block_content">{{ tempDetails.CtrlData }}</span>
                  </el-tooltip>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="20" :offset="2">
              <div class="grid-content bg-purple">
                <el-form-item label="响应数据:">
                  <el-tooltip class="block_content_item" effect="dark" :content="tempDetails.ReturnData"  placement="bottom" popper-class="test_tooltip">
                    <span class="block_content">{{ tempDetails.ReturnData }}</span>
                  </el-tooltip>
                </el-form-item>
              </div>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button class="add_edit_btn determine" @click="dialogDetails = false">
          返回
        </el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import Pagination from '@/components/Pagination'
import { GetMeterInfo, GetFactoryType, GetMeterType, GetPricePlan, CtrlCmdSend, CtrlQuery, CtrlRetry, CtrlCancel } from '@/api/basics'
import moment from 'moment'

export default {
  name: 'RemoteOrder',
  components: {
    Pagination
  },
  data() {
    return {
      Parameter: {
        PageSize: 10,
        PageIndex: 1,
        OrderBy: 'MeterId',
        isDesc: true
      },
      ParameterCtrl: {
        PageSize: 10,
        PageIndex: 1,
        OrderBy: '',
        isDesc: true
      },
      conModel: {
        ICCardNo: '',
        Name: '',
        PlanSendTime: moment().format('YYYY-MM-DD HH:mm'), // 计划时间
        SearchKey: ''
      },
      conModelCtrl: {
        TargetCommNoList: '', // 通信编号 []
        ProcessorName: '', // 处理程序
        TargetDevtype: '', // 设备类型
        CtrlTimeFrom: '', // 生成时间开始
        CtrlTimeTo: '', //  生成时间结束
        CtrlStateList: '', // 任务状态
      },
      temp: {
        BranchName: '',
        BranchAddr: '',
        ContactMan: '',
        ContactPhone: '',
        Remark: ''
      },
      order: 'ReadMeter', // 命令类型
      PriceNo: '', // 价格方案编号
      activeName: 'first',
      batchRow: [], // 勾选
      listPricePlan: [], // 价格方案
      conModelCopy: {}, // 远程命令
      conModelCopyCtrl: { // 命令查询
        TargetCommNoList: [], // 通信编号
        ProcessorName: '', // 处理程序
        TargetDevtype: '', // 设备类型
        CtrlTimeFrom: '', // 生成时间开始
        CtrlTimeTo: '', //  生成时间结束
        CtrlStateList: [], // 任务状态
      }, 
      
      listLoading: false,
      list: [],
      total: 0,
      listCtrl: [],
      totalCtrl: 0,
      listMeterType: [], // 表计类型
      listFactory: [], // 表计厂家
      tempDetails: {},
      dialogDetails: false,
      status: true, // 价格方案状态
      rules: {
        BranchName: [
          { required: true, message: '请输入充值量', trigger: 'change' }
        ],
        BranchAddr: [
          { required: true, message: '请输入充值金额', trigger: 'change' }
        ],
        ContactMan: [
          { required: true, message: '请选择充值类型', trigger: 'change' }
        ],
        ContactPhone: [
          { required: true, message: '请选择支付方式', trigger: 'change' }
        ]
      }
    }
  },
  watch: {
    'order': {
      handler(val) {
        if (val === 'ChangePrice') {
          this.status = false
        } else {
          this.status = true
          this.PriceNo = ''
        }
      }
    }
  },
  activated() {
    this.GetPricePlan()
  },
  created() {
    this.getList()
    this.GetPricePlan()
    // this.GetFactoryType()
    this.CtrlQuery('init')
  },
  methods: {
    CtrlState(state) {
      switch (state) {
        case 0:
            return '等待发送'
        case 1:
            return '已经发送'
        case 2:
            return '已经应答'
        case 3:
            return '任务成功'
        case 4:
            return '任务失败'
        case 5:
            return '任务被取消'
        case 6:
            return '任务超时'
        case 7:
            return '发送数据失败'
        default:
            return '其他错误'
      }
    },
    Processor(type) {
      switch (type) {
        case 'iotmeterv1':
            return '物联网表'
        case 'icrfmeterv2':
            return 'IC无线预付费表'
        case 'wlmeterv2':
            return '无线后付费表'
        case 'lorameterv1':
            return 'LoRaWAN表'
        default:
            return '其他'
      }
    },
    Devtype(type) {
      switch (type) {
        case 1:
            return '表计'
        case 2:
            return 'RTU'
        default:
            return '其他'
      }
    },
    handleClick(tab, event) {
      this.$refs.multipleTable.clearSelection() // 清空表格选择
      this.batchRow = []
      switch (this.activeName) {
        case 'first':
            return this.getList()
        case 'second':
            return this.CtrlQuery()
        default:
            return '暂无数据'
      }
    },
    mySelect(selection, row) {
      const arr = []
      selection.map(it => {
        arr.push(it.MeterId)
      })
      this.batchRow = arr
    },
    mySelect_2(selection, row) {
      const arr = []
      selection.map(it => {
        arr.push(it.CtrlId)
      })
      this.batchRow = arr
    },
    date(val) {
        return moment(val).format('YYYY-MM-DD HH:mm:ss')
    },
    // 发送命令
    remoteOrder() {
      if (this.batchRow.length == 0) {
        this.$message({
          message: '请至少选择一个表记',
          type: 'error'
        })
        return
      }
      if (this.conModel.PlanSendTime == '' || this.conModel.PlanSendTime === null) {
        this.$message({
          message: '请选择发送时间',
          type: 'error'
        })
        return
      }
      if (this.order === 'ChangePrice') {
        if (this.PriceNo == '') {
          this.$message({
            message: '请选择价格',
            type: 'error'
          })
          return
        }
      }
      let Parameter = {
        MeterIds: this.batchRow,
        Action: this.order,
        PriceNo: this.PriceNo,
        PlanSendTime: this.conModel.PlanSendTime
      }
      
      CtrlCmdSend(Parameter).then(res => {
        if (res.State === 'success') {
          this.$message({
            message: '命令发送成功',
            type: 'success'
          })
          this.$refs.multipleTable.clearSelection() // 清空表格选择
          this.batchRow = []
          this.order = 'ReadMeter'
          this.PriceNo = ''
        }
      })
    },
    // 重发命令
    CtrlRetry() {
      if (this.batchRow.length == 0) {
        this.$message({
          message: '请至少选择一个表记',
          type: 'error'
        })
        return
      }
      CtrlRetry(this.batchRow).then(res => {
        if (res.State === 'success') {
          this.$message({
            message: '命令重发成功',
            type: 'success'
          })
          this.$refs.multipleTable.clearSelection() // 清空表格选择
          this.batchRow = []
          this.order = 'ReadMeter'
          this.CtrlQuery()
        }
      })
    },
    // 取消命令
    CtrlCancel() {
      if (this.batchRow.length == 0) {
        this.$message({
          message: '请至少选择一个表记',
          type: 'error'
        })
        return
      }
      CtrlCancel(this.batchRow).then(res => {
        if (res.State === 'success') {
          this.$message({
            message: '命令取消成功',
            type: 'success'
          })
          this.$refs.multipleTable.clearSelection() // 清空表格选择
          this.batchRow = []
          this.order = 'ReadMeter'
          this.CtrlQuery()
        }
      })
    },
    // 表计信息
    getList(init) {
      if (init === 'search') {
        this.Parameter.PageIndex = 1
        this.conModelCopy = {}
        this.conModelCopy.PriceNo = this.PriceNo
      }
      if (this.conModel.ICCardNo.trim() !== '' && init === 'search') {
        this.conModelCopy.ICCardNo = this.conModel.ICCardNo.trim()
      }
      if (this.conModel.Name.trim() !== '' && init === 'search') {
        this.conModelCopy.Name = this.conModel.Name.trim()
      }
      if (this.conModel.SearchKey.trim() !== '' && init === 'search') {
        this.conModelCopy.SearchKey = this.conModel.SearchKey.trim()
      }
      this.listLoading = true
      let Parameter = {
        ...this.Parameter,
        ...this.conModelCopy
      }
      GetMeterInfo(Parameter).then(res => {
        this.list = res.Data
        this.total = res.Total
        this.listLoading = false
      })
    },
    // 命令查询
    CtrlQuery(init) {
      if (init === 'search') {
        this.ParameterCtrl.PageIndex = 1
        this.conModelCopyCtrl = {
          TargetCommNoList: [], // 通信编号 []
          ProcessorName: '', // 处理程序
          TargetDevtype: '', // 设备类型
          CtrlTimeFrom: '', // 生成时间开始
          CtrlTimeTo: '', //  生成时间结束
          CtrlStateList: [], // 任务状态
          CtrlDefineNo: '',
          CtrlTypeList: []

        }
        this.conModelCopyCtrl.ProcessorName = this.conModelCtrl.ProcessorName
        this.conModelCopyCtrl.CtrlStateList.push(this.conModelCtrl.CtrlStateList)
        this.conModelCopyCtrl.TargetDevtype = this.conModelCtrl.TargetDevtype
      }
      if (this.conModelCtrl.CtrlStateList === '') {
        this.conModelCopyCtrl.CtrlStateList = []
      }
      if (init === 'init') {
        this.ParameterCtrl.PageIndex = 1
        this.conModelCopyCtrl = {}
      }
      if (this.conModelCtrl.TargetCommNoList.trim() !== '' && init === 'search') {
        this.conModelCopyCtrl.TargetCommNoList.push(this.conModelCtrl.TargetCommNoList.trim())
      }
      if (this.conModelCtrl.CtrlTimeFrom !== null && this.conModelCtrl.CtrlTimeFrom !== '' && init === 'search') {
        this.conModelCopyCtrl.CtrlTimeFrom = moment(this.conModelCtrl.CtrlTimeFrom).format('YYYY-MM-DD HH:mm')
      }
      if (this.conModelCtrl.CtrlTimeTo !== null && this.conModelCtrl.CtrlTimeTo !== '' && init === 'search') {
        this.conModelCopyCtrl.CtrlTimeTo = moment(this.conModelCtrl.CtrlTimeTo).format('YYYY-MM-DD HH:mm')
      }
      this.listLoading = true
      let Parameter = {
        ...this.ParameterCtrl,
        ...this.conModelCopyCtrl
      }
      CtrlQuery(Parameter).then(res => {
        this.listCtrl = res.Data
        this.totalCtrl = res.Total
        this.listLoading = false
      })
    },
    detailsPopup(row) {
      this.tempDetails = Object.assign({}, row)
      this.dialogDetails = true
    },
    // 价格方案
    GetPricePlan() {
      const Parameter = {
        PageSize: 99999,
        PageIndex: 1,
        OrderBy: 'BuildTime',
        isDesc: true
      }
      GetPricePlan(Parameter).then(res => {
        this.listPricePlan = res.Data
      })
    },
    // 表计类型
    GetMeterType(FactoryNo) {
      this.conModel.Type = ''
      var Parameter = {
        PageSize: 99999,
        PageIndex: 1,
        OrderBy: 'CalcTypeCode',
        isDesc: true,
        FactoryNo: FactoryNo
      }
      GetMeterType(Parameter).then(res => {
        this.listMeterType = res.Data
      })
    },
    // 表计厂家
    GetFactoryType() {
      var Parameter = {
        PageSize: 99999,
        PageIndex: 1,
        OrderBy: 'FactoryNo',
        isDesc: true
      }
      GetFactoryType(Parameter).then(res => {
        this.listFactory = res.Data
      })
    },
    resetTemp() {
      this.temp = {
        BranchName: '',
        BranchAddr: '',
        ContactMan: '',
        ContactPhone: '',
        Remark: ''
      }
    }
  }
}
</script>

<style scoped>
  .tips {
    margin: 0px;
    padding-left: 27px;
    padding-bottom: 8px;
  }

  .second_row_2 {
    padding-top: 0px;
    padding-bottom: 10px;
  }

  .remote_search_picker {
    width: 168px;
  }
</style>
